package com.lenovo.vod.player.callback;

import com.lenovo.vod.player.Constant;
import com.lenovo.vod.player.Engine;

import android.media.MediaPlayer;
import android.media.MediaPlayer.OnVideoSizeChangedListener;
import android.util.Log;

public class VideoSizeChangedListener implements OnVideoSizeChangedListener {
	private Engine mEngine;

	public VideoSizeChangedListener(Engine engine) {
		mEngine = engine;
	}

	@Override
	public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
		Log.d(Constant.TAG, "onVideoSizeChanged called");
		if (width == 0 || height == 0) {
			Log.e(Constant.TAG, "invalid video width(" + width + ") or height("
					+ height + ")");
		}
		mEngine.setVideoSizeKnown(true);
		mEngine.setVideoWidth(width);
		mEngine.setVideoHeight(height);
	}
}
